#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include <fcntl.h>
#include<signal.h>

struct sigaction act, oact;
void handler(int signo)
{
    printf("get a signal: %d\n", signo);
    sigaction(SIGINT, &oact, NULL);
}
int main()
{
    memset(&act, 0, sizeof(act));
    memset(&oact, 0, sizeof(oact));
 
    act.sa_handler = handler;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
 
    sigaction(SIGINT, &act, &oact);
    while(1){
        printf("I am a process!\n");
        sleep(1);
    }
    return 0;
}